//******************************
//Scripting
//Map: Axis Lab
//Last edited by: Chris S.
//******************************

game_manager
{
	spawn
	{
			create
		{
			scriptName "bugfix1"
			classname "func_fakebrush"
			origin "540 2360 215"
			contents 65536  // CONTENTS_PLAYERCLIP
			mins "-42 -60 -60"
			maxs "42 42 5"
		}
		
		wm_set_round_timelimit		10
		wm_number_of_objectives		1

		wait 50
		setstate defense_toi invisible
		setstate defense_materials invisible
		setstate defense_materials_clip invisible
		setstate defense_flag invisible
		setstate defense_wire invisible
		setstate defense_hurt invisible
		setstate defense_teeth1 invisible
		setstate defense_teeth2 invisible
		setstate defense_teeth3 invisible

		setstate root_cellar_toi invisible
		setstate root_cellar invisible

		setstate sewers_toi invisible
		setstate sewers invisible

		setstate ramp invisible
		setstate ramp_materials invisible
		setstate ramp_materials_flag invisible
		setstate ramp_toi invisible

		setstate elevator_generator default
		setstate elevator_generator_toi invisible
		setstate elevator_generator_materials invisible
		setstate elevator_generator_materials_clip invisible
		setstate elevator_generator2_toi invisible
		setstate elevator_generator2 invisible
		setstate elevator_generator2_materials_clip invisible
		setstate elevator_generator2_materials invisible

		setstate bookcase_iu_close invisible
		setstate bookcase_iu_open invisible
		
		setstate rockbutton_iu invisible
		
		setstate cart_enabler_allies invisible
		setstate cart_enabler_axis invisible
		setstate cart_trigger invisible
		setstate cart_trigger_toi invisible
		setstate cart invisible
		setstate cart2 invisible
		setstate fakeobj2 invisible
		
		setstate back_door invisible
		setstate back_door_toi invisible
		setstate team_doors invisible

		setstate war_room_door invisible
		setstate war_room_door_toi invisible

		setstate north_hacabinet_toi invisible
		setstate north_hacabinet_cm_marker invisible
		setstate cabin_hacabinet_toi invisible
		setstate cabin_hacabinet_cm_marker invisible

		setstate docs_toi invisible
		setstate docs_cm_marker invisible
		setstate docs_trans invisible
		setstate docs_holder invisible

		setstate truck invisible
		setstate truck_smoke invisible

		setstate hill_top_spawn invisible
		alertentity allied_cabin

		setautospawn "Axis Bunker" 		0
		setautospawn "Allied Cabin"		1

		wait 1000

		wm_teamvoiceannounce 0 "axis_hq_compost_construct"
		wm_teamvoiceannounce 1 "allies_hq_compost_construct"

		disablespeaker flag_sound
		disablespeaker axis_compost_sound
		disablespeaker allied_compost_sound
	}
}

ceilingfan
{
	spawn
	{
		wait 100
		setrotation	0 300 0
	}
}

back_door
{
	spawn
	{
		wait 600
		remove
	}
}

back_door_toi
{
	spawn
	{
		wait 600
		remove
	}
}

team_doors
{
	spawn
	{
		wait 600
		remove
	}
}

back_wall_destroyed
{
	spawn
	{
		wait 600
		remove
	}
}

elevator_generator2_materials
{
	spawn
	{
		wait 600
		remove
	}
}

elevator_generator2_materials_clip
{
	spawn
	{
		wait 600
		remove
	}
}

elevator_generator2
{
	spawn
	{
		wait 600
		remove
	}
}

elevator_generator2_toi
{
	spawn
	{
		wait 600
		remove
	}
}

elevator_generator_materials
{
	spawn
	{
		wait 600
		remove
	}
}

elevator_generator_materials_clip
{
	spawn
	{
		wait 600
		remove
	}
}


elevator_generator_toi
{
	spawn
	{
		wait 600
		remove
	}
}

docs_holder
{
	spawn
	{
		wait 600
		remove
	}
}

docs_trans
{
	spawn
	{
		wait 600
		remove
	}
}

docs_cm_marker
{
	spawn
	{
		wait 600
		remove
	}
}

docs_toi
{
	spawn
	{
		wait 600
		remove
	}
}

spawn_axis_hill_top
{
	spawn
	{
		remove
	}
}

hill_flag
{
	spawn
	{
		wait 500
		remove
	}
}

sewers
{
	spawn
	{
		wait 200
		remove
	}
}

root_cellar
{
	spawn
	{
		wait 200
		remove
	}
}

root_cellar_toi
{
	spawn
	{
		wait 200
		remove
	}
}

back_wall
{
	spawn
	{
	}
}

war_room_door
{
	spawn
	{
		wait 300
		remove
	}
}

war_room_door_toi
{
	spawn
	{
		wait 300
		remove
	}
}

ramp
{
	spawn
	{
		wait 200
		remove
	}
}

ramp_materials
{
	spawn
	{
		wait 200
		remove
	}
}

ramp_materials_flag
{
	spawn
	{
		wait 200
		remove
	}
}

ramp_toi
{
	spawn
	{
		wait 200
		remove
	}
}

// ================================================
// =============== COMMAND POSTS ==================
// ================================================

allied_radio_destroyed
{
	spawn
	{
		wait 400
		setstate allied_radio_destroyed invisible
		setstate allied_radio_destroyed_model invisible
	}

	trigger hide
	{
		setstate allied_radio_destroyed invisible
		setstate allied_radio_destroyed_model invisible
	}

	trigger show
	{
		accum 0 abort_if_equal 0
		setstate allied_radio_destroyed default
		setstate allied_radio_destroyed_model default
	}

	trigger enable
	{
		accum 0 set 1
	}
}

allied_radio_closed
{
	trigger hide
	{
		setstate allied_radio_closed invisible
		setstate allied_radio_closed_model invisible
	}

	trigger show
	{
		accum 0 abort_if_equal 1
		setstate allied_radio_closed default
		setstate allied_radio_closed_model default
	}

	trigger disable
	{
		accum 0 set 1
	}
}

allied_radio_built
{
	spawn
	{
		wait 1000

		constructible_class 2
		trigger allied_radio_built setup

		disablespeaker allied_compost_sound
	}

	trigger setup
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0
	}

	buildstart final
	{
		trigger allied_radio_built_model trans

		trigger allied_radio_destroyed hide
		trigger allied_radio_closed 	hide
	}

	built final
	{
		trigger allied_radio_built_model show

		trigger allied_radio_destroyed enable
		trigger allied_radio_closed disable

		trigger allied_radio_built_model enable_allied_features

		enablespeaker allied_compost_sound
	}

	decayed final
	{
		trigger allied_radio_built_model hide

		trigger allied_radio_destroyed show
		trigger allied_radio_closed 	show
	}

	death
	{
		trigger allied_radio_built_model hide

		trigger allied_radio_destroyed show

		trigger allied_radio_built_model disable_allied_features

		disablespeaker allied_compost_sound
	}
}

allied_radio_built_model
{
	spawn
	{
		wait 400
		setstate allied_radio_built_model invisible
	}

	trigger show
	{
		setstate allied_radio_built_model default
	}

	trigger hide
	{
		setstate allied_radio_built_model invisible
	}

	trigger trans
	{
		setstate allied_radio_built_model underconstruction
	}

	trigger enable_allied_features
	{
		setchargetimefactor 1 soldier 0.75
		setchargetimefactor 1 lieutenant 0.75
		setchargetimefactor 1 medic 0.75
		setchargetimefactor 1 engineer 0.75
		setchargetimefactor 1 covertops 0.75
		sethqstatus 1 1

		wm_announce	"^5Allied Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

		wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 8 1 1
		wm_objective_status 8 0 2

	}

	trigger disable_allied_features
	{
		// Some kind of UI pop-up to alert players
		wm_announce	"^1Axis team has destroyed the Allied Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 1 "allies_hqt_compost_construc"

		wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
		// *----------------------------------- vo ------------------------------------------*

		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0

		wm_objective_status 8 1 0
		wm_objective_status 8 0 0
	}
}

axis_radio_destroyed
{
	spawn
	{
		wait 400
		setstate axis_radio_destroyed invisible
		setstate axis_radio_destroyed_model invisible
	}

	trigger hide
	{
		setstate axis_radio_destroyed invisible
		setstate axis_radio_destroyed_model invisible
	}

	trigger show
	{
		accum 0 abort_if_equal 0
		setstate axis_radio_destroyed default
		setstate axis_radio_destroyed_model default
	}

	trigger enable
	{
		accum 0 set 1
	}
}

axis_radio_closed
{
	trigger hide
	{
		setstate axis_radio_closed invisible
		setstate axis_radio_closed_model invisible
	}

	trigger show
	{
		accum 0 abort_if_equal 1
		setstate axis_radio_closed default
		setstate axis_radio_closed_model default
	}

	trigger disable
	{
		accum 0 set 1
	}
}

axis_radio_built
{
	spawn
	{
		wait 1000
		constructible_class 2
		trigger axis_radio_built setup

		disablespeaker axis_compost_sound
	}

	trigger setup
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0
	}

	buildstart final
	{
		trigger axis_radio_built_model trans

		trigger axis_radio_destroyed hide
		trigger axis_radio_closed 	hide
	}

	built final
	{
		trigger axis_radio_built_model show

		trigger axis_radio_destroyed enable
		trigger axis_radio_closed 	disable

		trigger axis_radio_built_model enable_axis_features

		enablespeaker axis_compost_sound
	}

	decayed final
	{
		trigger axis_radio_built_model hide

		trigger axis_radio_destroyed show
		trigger axis_radio_closed 	show
	}

	death
	{
		trigger axis_radio_built_model hide

		trigger axis_radio_destroyed show

		trigger axis_radio_built_model disable_axis_features

		disablespeaker axis_compost_sound
	}
}

axis_radio_built_model
{
	spawn
	{
		wait 400
		setstate axis_radio_built_model invisible
	}

	trigger show
	{
		setstate axis_radio_built_model default
	}

	trigger hide
	{
		setstate axis_radio_built_model invisible
	}

	trigger trans
	{
		setstate axis_radio_built_model underconstruction
	}

	trigger enable_axis_features
	{
		setchargetimefactor 0 soldier 0.75
		setchargetimefactor 0 lieutenant 0.75
		setchargetimefactor 0 medic 0.75
		setchargetimefactor 0 engineer 0.75
		setchargetimefactor 0 covertops 0.75
		sethqstatus 0 1

		wm_announce	"^1Axis Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

		wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
		// *----------------------------------- vo ------------------------------------------*

		wm_objective_status 7 1 2
		wm_objective_status 7 0 1

	}

	trigger disable_axis_features
	{
		// Some kind of UI pop-up to alert players
		wm_announce	"^5Allied team has destroyed the Axis Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_damaged"
		// *----------------------------------- vo ------------------------------------------*

		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0

		wm_objective_status 7 1 0
		wm_objective_status 7 0 0
	}
}

// ===================================================
// ============== END COMMAND POSTS ==================
// ===================================================
// (Objectives secondary)

axis_bunker_mg42_clip
{
	spawn
	{
		wait 200
		trigger axis_bunker_mg42_clip setup

		constructible_class 2
	}

	trigger setup
	{
		setstate axis_bunker_mg42 invisible
		setstate axis_bunker_mg42_sbags invisible

		setstate axis_bunker_mg42_materials default
		setstate axis_bunker_mg42_materials_clip default
	}

	buildstart final
	{
		setstate axis_bunker_mg42 underconstruction
		setstate axis_bunker_mg42_sbags underconstruction

		setstate axis_bunker_mg42_materials default
		setstate axis_bunker_mg42_materials_clip default
	}

	built final
	{
		setstate axis_bunker_mg42 default
		setstate axis_bunker_mg42_sbags default

		setstate axis_bunker_mg42_materials invisible
		setstate axis_bunker_mg42_materials_clip invisible

		wm_announce "^1The Axis Bunker MG Nest has been constructed."
	}

	decayed final
	{
		setstate axis_bunker_mg42 invisible
		setstate axis_bunker_mg42_sbags invisible

		setstate axis_bunker_mg42_materials default
		setstate axis_bunker_mg42_materials_clip default
	}

	death
	{
		setstate axis_bunker_mg42 invisible
		setstate axis_bunker_mg42_sbags invisible
		repairmg42 axis_bunker_mg42
		setstate axis_bunker_mg42_materials default
		setstate axis_bunker_mg42_materials_clip default

		wm_announce "^5The Axis Bunker MG Nest has been destroyed."
	}
}

allied_cabin_mg42_clip
{
	spawn
	{
		wait 200
		trigger allied_cabin_mg42_clip setup

		constructible_class 2
	}

	trigger setup
	{
		setstate allied_cabin_mg42 invisible

		setstate allied_cabin_mg42_materials default
		setstate allied_cabin_mg42_materials_clip default
	}

	buildstart final
	{
		setstate allied_cabin_mg42 underconstruction

		setstate allied_cabin_mg42_materials default
		setstate allied_cabin_mg42_materials_clip default
	}

	built final
	{
		setstate allied_cabin_mg42 default
		setstate allied_cabin_mg42_materials invisible
		setstate allied_cabin_mg42_materials_clip invisible

		wm_announce "^5The Allied Cabin MG Nest has been constructed."
	}

	decayed final
	{
		setstate allied_cabin_mg42 invisible
		setstate allied_cabin_mg42_materials default
		setstate allied_cabin_mg42_materials_clip default
	}

	death
	{
		setstate allied_cabin_mg42 invisible
		repairmg42 allied_cabin_mg42
		setstate allied_cabin_mg42_materials default
		setstate allied_cabin_mg42_materials_clip default

		wm_announce "^1The Allied Cabin MG Nest has been destroyed."
	}
}

///////////////////////////////////////////////////
// Functions for the elevator and elevator doors //
///////////////////////////////////////////////////


//Cabin Level Door

cabindoor1
{
	trigger cabindooropen
	{
		//cabin door open
		trigger cabindoor1 cabindoor1open
		trigger cabindoor2 cabindoor2open
		playsound sound/movers/doors/door3_open.wav volume 96
		wait 742
		playsound sound/movers/doors/door3_loopo.wav looping
		wait 500
		stopsound
		playsound sound/movers/doors/door3_endo.wav volume 96
		wait 1000
	}

	trigger cabindoorclose
	{
		//cabin door close
		trigger cabindoor1 cabindoor1close
		trigger cabindoor2 cabindoor2close
		playsound sound/movers/doors/door3_open.wav volume 96
		wait 742
		playsound sound/movers/doors/door3_loopo.wav looping
		wait 500
		stopsound
		playsound sound/movers/doors/door3_endo.wav volume 96
	}

	trigger cabindoor1open
	{
		gotomarker cabinopen 40
	}

	trigger cabindoor1close
	{
		gotomarker cabinclosed1 40
	}

	trigger halt
	{
		stopsound
		halt
		trigger cabindoor2 halt
	}
}

cabindoor2
{
	trigger cabindoor2open
	{
		gotomarker cabinopen 20
	}

	trigger cabindoor2close
	{
		gotomarker cabinclosed2 20
	}

	trigger halt
	{
		stopsound
		halt
	}
}

//Basement Level 1 Door

b1door1
{
	trigger b1dooropen
	{
		//b1door open
		trigger b1door1 b1door1open
		trigger b1door2 b1door2open
		trigger b1door3 b1door3open
		trigger b1door4 b1door4open
		playsound sound/movers/doors/door3_open.wav volume 96
		wait 742
		playsound sound/movers/doors/door3_loopo.wav looping
		wait 500
		stopsound
		playsound sound/movers/doors/door3_endo.wav volume 96
		wait 1000
	}

	trigger b1doorclose
	{
		//b1door close
		trigger b1door1 b1door1close
		trigger b1door2 b1door2close
		trigger b1door3 b1door3close
		trigger b1door4 b1door4close
		playsound sound/movers/doors/door3_open.wav volume 96
		wait 742
		playsound sound/movers/doors/door3_loopo.wav looping
		wait 500
		stopsound
		playsound sound/movers/doors/door3_endo.wav volume 96
	}

	trigger b1door1open
	{
		gotomarker b1doorleft 20
	}

	trigger b1door1close
	{
		gotomarker b1door1 20
	}

	trigger halt
	{
		stopsound
		halt
		trigger b1door2 halt
		trigger b1door3 halt
		trigger b1door4 halt
	}
}

b1door2
{
	trigger b1door2open
	{
		gotomarker b1doorleft 40
	}

	trigger b1door2close
	{
		gotomarker b1door2 40
	}

	trigger halt
	{
		stopsound
		halt
	}
}

b1door3
{
	trigger b1door3open
	{
		gotomarker b1doorright 40
	}

	trigger b1door3close
	{
		gotomarker b1door3 40
	}

	trigger halt
	{
		stopsound
		halt
	}
}

b1door4
{
	trigger b1door4open
	{
		gotomarker b1doorright 20
	}

	trigger b1door4close
	{
		gotomarker b1door4 20
	}

	trigger halt
	{
		stopsound
		halt
	}
}

//Basement Level 2 Door

b2door1
{
	trigger b2dooropen
	{
		//b2door open
		trigger b2door1 b2door1open
		trigger b2door2 b2door2open
		trigger b2door3 b2door3open
		trigger b2door4 b2door4open
		playsound sound/movers/doors/door3_open.wav volume 96
		wait 742
		playsound sound/movers/doors/door3_loopo.wav looping
		wait 500
		stopsound
		playsound sound/movers/doors/door3_endo.wav volume 96
		wait 1000
	}

	trigger b2doorclose
	{
		//b2door close
		trigger b2door1 b2door1close
		trigger b2door2 b2door2close
		trigger b2door3 b2door3close
		trigger b2door4 b2door4close
		playsound sound/movers/doors/door3_open.wav volume 96
		wait 742
		playsound sound/movers/doors/door3_loopo.wav looping
		wait 500
		stopsound
		playsound sound/movers/doors/door3_endo.wav volume 96
	}

	trigger b2door1open
	{
		gotomarker b2doorleft 20
	}

	trigger b2door1close
	{
		gotomarker b2door1 20
	}

	trigger halt
	{
		stopsound
		halt
		trigger b2door2 halt
		trigger b2door3 halt
		trigger b2door4 halt
	}
}

b2door2
{
	trigger b2door2open
	{
		gotomarker b2doorleft 40
	}

	trigger b2door2close
	{
		gotomarker b2door2 40
	}

	trigger halt
	{
		stopsound
		halt
	}
}

b2door3
{
	trigger b2door3open
	{
		gotomarker b2doorright 40
	}

	trigger b2door3close
	{
		gotomarker b2door3 40
	}

	trigger halt
	{
		stopsound
		halt
	}
}

b2door4
{
	trigger b2door4open
	{
		gotomarker b2doorright 20
	}

	trigger b2door4close
	{
		gotomarker b2door4 20
	}

	trigger halt
	{
		stopsound
		halt
	}
}

//Basement Level 3 Door

b3door1
{
	trigger b3dooropen
	{
		//b3door open
		trigger b3door1 b3door1open
		trigger b3door2 b3door2open
		trigger b3door3 b3door3open
		trigger b3door4 b3door4open
		playsound sound/movers/doors/door3_open.wav volume 96
		wait 742
		playsound sound/movers/doors/door3_loopo.wav looping
		wait 500
		stopsound
		playsound sound/movers/doors/door3_endo.wav volume 96
		wait 1000
	}

	trigger b3doorclose
	{
		//b3door close
		trigger b3door1 b3door1close
		trigger b3door2 b3door2close
		trigger b3door3 b3door3close
		trigger b3door4 b3door4close
		playsound sound/movers/doors/door3_open.wav volume 96
		wait 742
		playsound sound/movers/doors/door3_loopo.wav looping
		wait 500
		stopsound
		playsound sound/movers/doors/door3_endo.wav volume 96
	}

	trigger b3door1open
	{
		gotomarker b3doorleft 20
	}

	trigger b3door1close
	{
		gotomarker b3door1 20
	}

	trigger halt
	{
		stopsound
		halt
		trigger b3door2 halt
		trigger b3door3 halt
		trigger b3door4 halt
	}
}

b3door2
{
	trigger b3door2open
	{
		gotomarker b3doorleft 40
	}

	trigger b3door2close
	{
		gotomarker b3door2 40
	}

	trigger halt
	{
		stopsound
		halt
	}
}

b3door3
{
	trigger b3door3open
	{
		gotomarker b3doorright 40
	}

	trigger b3door3close
	{
		gotomarker b3door3 40
	}

	trigger halt
	{
		stopsound
		halt
	}
}

b3door4
{
	trigger b3door4open
	{
		gotomarker b3doorright 20
	}

	trigger b3door4close
	{
		gotomarker b3door4 20
	}

	trigger halt
	{
		stopsound
		halt
	}
}

// Elevator movements
elevator
{
	spawn
	{
		// accum 0 = Call button pressed. (cabin)
		// accum 1 = Call button pressed. (floor b1)
		// accum 2 = Call button pressed. (floor b2)
		// accum 3 = Call button pressed. (floor b3)
		accum 4 set 2	 // Current floor the elevator is moving to or is on.
		// accum 5 = Is the elevator moving? Call Button lockout.
		// accum 6 = Is Disabled?
		// accum 7 = Is nuke in the elevator?

		wait 2000
		trigger b2door1 b2dooropen
	}

	trigger cabin_call_button
	{
		accum 4 abort_if_equal 0
		accum 0 set 1
		accum 5 abort_if_equal 1

		trigger elevator call_button_check
	}
	
	trigger b1_call_button
	{
		accum 4 abort_if_equal 1
		accum 1 set 1
		accum 5 abort_if_equal 1

		trigger elevator call_button_check
	}

	trigger b2_call_button
	{
		accum 4 abort_if_equal 2
		accum 2 set 1
		accum 5 abort_if_equal 1

		trigger elevator call_button_check
	}

	trigger b3_call_button
	{
		accum 4 abort_if_equal 3
		accum 3 set 1
		accum 5 abort_if_equal 1

		trigger elevator call_button_check
	}

	trigger call_button_check
	{
		accum 5 abort_if_equal 1

		accum 3 trigger_if_equal 1 elevator goto_b3
		accum 3 abort_if_equal 1

		accum 2 trigger_if_equal 1 elevator goto_b2
		accum 2 abort_if_equal 1

		accum 1 trigger_if_equal 1 elevator goto_b1
		accum 1 abort_if_equal 1

		accum 0 trigger_if_equal 1 elevator goto_cabin
	}

	trigger goto_cabin
	{
		accum 6 abort_if_greater_than 0
		accum 4 trigger_if_equal 1 elevator b1_to_1
		accum 4 trigger_if_equal 2 elevator b2_to_1
		accum 4 trigger_if_equal 3 elevator b3_to_1
	}
	
	trigger goto_b1
	{
		accum 6 abort_if_greater_than 0
		accum 4 trigger_if_equal 0 elevator 1_to_b1
		accum 4 trigger_if_equal 2 elevator b2_to_b1
		accum 4 trigger_if_equal 3 elevator b3_to_b1
	}

	trigger goto_b2
	{
		accum 6 abort_if_greater_than 0
		accum 4 trigger_if_equal 0 elevator 1_to_b2
		accum 4 trigger_if_equal 1 elevator b1_to_b2
		accum 4 trigger_if_equal 3 elevator b3_to_b2
	}

	trigger goto_b3
	{
		accum 6 abort_if_greater_than 0
		accum 4 trigger_if_equal 0 elevator 1_to_b3
		accum 4 trigger_if_equal 1 elevator b1_to_b3
		accum 4 trigger_if_equal 2 elevator b2_to_b3
	}

	trigger 1_to_b1
	{
		//from floor 1 to b1
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 1
		accum 1 set 0
		trigger cabindoor1 cabindoorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floor1_bottom 40 wait
		gotomarker floorb1_top 90 wait
		gotomarker floorb1 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger b1door1 b1dooropen
		
		wait 2000
		setstate b1_button_up default
		setstate b1_button_down default

		wait 3000
		accum 5 set 0
		trigger elevator call_button_check
	}

	trigger 1_to_b2
	{
		//from floor 1 to b2
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 2
		accum 2 set 0
		trigger cabindoor1 cabindoorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floor1_bottom 40 wait
		gotomarker floorb2_top 90 wait
		gotomarker floorb2 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger b2door1 b2dooropen
		
		wait 2000
		setstate b2_button_up default
		setstate b2_button_down default

		wait 3000
		accum 5 set 0
		trigger elevator call_button_check
	}

	trigger 1_to_b3
	{
		//from floor 1 to b3
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 3
		accum 3 set 0
		trigger cabindoor1 cabindoorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floor1_bottom 40 wait
		gotomarker floorb3_top 90 wait
		gotomarker floorb3 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger b3door1 b3dooropen

		wait 2000		
		setstate b3_button_up default
		
		wait 3000
		accum 5 set 0
		trigger elevator call_button_check
	}
	
	trigger b1_to_1
	{
		//from floor b1 to 1
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 0
		accum 0 set 0
		trigger b1door1 b1doorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floorb1_top 40 wait
		gotomarker floor1_bottom 90 wait
		gotomarker floor1 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger cabindoor1 cabindooropen

		wait 2000
		setstate cabin_button_down default

		wait 3000
		accum 5 set 0
		trigger elevator call_button_check
	}
	
	trigger b1_to_b2
	{
		//from floor b1 to b2
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 2
		accum 2 set 0
		trigger b1door1 b1doorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floorb1_bottom 40 wait
		gotomarker floorb2_top 90 wait
		gotomarker floorb2 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger b2door1 b2dooropen
		
		wait 2000
		setstate b2_button_up default
		setstate b2_button_down default
		
		wait 3000
		accum 5 set 0
		trigger elevator call_button_check
	}

	trigger b1_to_b3
	{
		//from floor b1 to b3
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 3
		accum 3 set 0
		trigger b1door1 b1doorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floorb1_bottom 40 wait
		gotomarker floorb3_top 90 wait
		gotomarker floorb3 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger b3door1 b3dooropen

		wait 2000
		setstate b3_button_up default

		wait 3000
		accum 5 set 0
		trigger elevator call_button_check
	}

	trigger b2_to_1
	{
		//from floor b2 to 1
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 0
		accum 0 set 0
		trigger b2door1 b2doorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floorb2_top 40 wait
		gotomarker floor1_bottom 90 wait
		gotomarker floor1 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger cabindoor1 cabindooropen

		wait 2000
		setstate cabin_button_down default

		wait 4000
		accum 5 set 0
		trigger elevator call_button_check
	}

	trigger b2_to_b1
	{
		//from floor b2 to b1
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 1
		accum 1 set 0
		trigger b2door1 b2doorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floorb2_top 40 wait
		gotomarker floorb1_bottom 90 wait
		gotomarker floorb1 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger b1door1 b1dooropen
		
		wait 2000
		setstate b1_button_up default
		setstate b1_button_down default

		wait 3000
		accum 5 set 0
		trigger elevator call_button_check
	}

	trigger b2_to_b3
	{
		//from floor b2 to b3
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 3
		accum 3 set 0
		trigger b2door1 b2doorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96	
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floorb2_bottom 40 wait
		gotomarker floorb3_top 90 wait
		gotomarker floorb3 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger b3door1 b3dooropen

		wait 2000
		setstate b3_button_up default
		
		wait 3000
		accum 5 set 0
		trigger elevator call_button_check
	}
	
	trigger b3_to_1
	{
		//from floor b3 to 1
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 0
		accum 0 set 0
		trigger b3door1 b3doorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floorb3_top 40 wait
		gotomarker floor1_bottom 90 wait
		gotomarker floor1 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger cabindoor1 cabindooropen
		
		wait 2000
		setstate cabin_button_down default

		wait 4000
		accum 5 set 0
		trigger elevator call_button_check
	}

	trigger b3_to_b1
	{
		//from floor b3 to b1
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 1
		accum 1 set 0
		trigger b3door1 b3doorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floorb3_top 40 wait
		gotomarker floorb1_bottom 90 wait
		gotomarker floorb1 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger b1door1 b1dooropen
		
		wait 2000
		setstate b1_button_up default
		setstate b1_button_down default

		wait 3000
		accum 5 set 0
		trigger elevator call_button_check
	}

	trigger b3_to_b2
	{
		//from floor b3 to b2
		trigger cabin_button hide_all_buttons
		accum 5 set 1
		accum 4 set 2
		accum 2 set 0
		trigger b3door1 b3doorclose
		wait 1000
		playsound sound/movers/elevators/elev1_start.wav volume 96
		wait 800
		playsound sound/movers/elevators/elev1_loop.wav looping

		gotomarker floorb3_top 40 wait
		gotomarker floorb2_bottom 90 wait
		gotomarker floorb2 40 wait
		stopsound
		playsound sound/movers/elevators/elev1_end.wav volume 96
		trigger b2door1 b2dooropen
		
		wait 2000
		setstate b2_button_up default
		setstate b2_button_down default

		wait 3000
		accum 5 set 0
		trigger elevator call_button_check
	}
}

// Elevator Buttons (call, up, down)

cabin_button
{
	spawn
	{
		wait 1000
		setstate cabin_button_down invisible
	}

	trigger hide_all_buttons
	{
		setstate cabin_button_down invisible
		setstate b1_button_up invisible
		setstate b1_button_down invisible
		setstate b2_button_up invisible
		setstate b2_button_down invisible
		setstate b3_button_up invisible
	}

	trigger call
	{
		togglespeaker cabin_call_button_sound
		trigger elevator cabin_call_button
	}
	
	trigger down
	{
		togglespeaker cabin_button_sound
		trigger elevator goto_b1		
	}
}

b1_button
{
	spawn
	{
		wait 1000
		setstate b1_button_down invisible
		setstate b1_button_up invisible
	}

	trigger call
	{
		togglespeaker b1_call_button_sound
		trigger elevator b1_call_button
	}

	trigger up
	{
		togglespeaker b1_button_sound
		trigger elevator goto_cabin
	}

	trigger down
	{
		togglespeaker b1_button_sound
		trigger elevator goto_b2
	}
}

b2_button
{
	spawn
	{
		wait 1000
		setstate b2_button_down default
		setstate b2_button_up default
	}

	trigger call
	{
		togglespeaker b2_call_button_sound
		trigger elevator b2_call_button
	}

	trigger up
	{
		togglespeaker b2_button_sound
		trigger elevator goto_b1
	}

	trigger down
	{
		togglespeaker b2_button_sound
		trigger elevator goto_b3
	}
}

b3_button
{
	spawn
	{
		wait 1000
		setstate b3_button_up invisible
	}

	trigger call
	{
		togglespeaker b3_call_button_sound
		trigger elevator b3_call_button
	}

	trigger up
	{
		togglespeaker b3_button_sound
		trigger elevator goto_b2
	}
}

rockbutton_iu
{
	spawn
	{
		wait 300
		remove
	}
}

rock
{
	spawn
	{
		wait 300
		gotomarker rockopen 50
	}
}

bookcasebutton
{
	spawn
	{
		wait 100
		remove
	}
}

bookcase
{
	spawn
	{
		wait 300
		gotomarker bookcaseopen 50
	}
}

cart
{
	spawn
	{
		wait 300
		remove
	}
}

cart_trigger
{
	spawn
	{
		wait 200
		remove
	}
}

cart_enabler_axis
{
	spawn
	{
		wait 300
		remove
	}
}

cart_enabler_allies
{
	spawn
	{
		wait 300
		remove
	}
}

cart_disabler
{
	spawn
	{
		wait 100
		remove
	}
}

cart_controller
{
	spawn
	{
		wait 300
		remove
	}
}

cart2
{
	spawn
	{
		wait 300
		remove
	}
}

fakeobj2
{
	spawn
	{	
		wait 300
		remove
	}
}

truck
{
	spawn
	{
		wait 100
		remove
	}
}

truck_disabler
{
	spawn
	{
		wait 100
		remove
	}
}

truck_enabler
{
	spawn
	{
		wait 100
		remove
	}
}

truck_trigger
{
	spawn
	{
		wait 200
		remove
	}
}

truck_build
{
	spawn
	{
		wait 100
		remove
	}
}

truck_construct
{
	spawn
	{
		wait 100
		remove
	}
}

truck_smoke
{
	spawn
	{
		wait 100
		remove
	}
}

truck_fwheel
{
	spawn
	{
		wait 100
		remove
	}
}

truck_bwheel1
{
	spawn
	{
		wait 100
		remove
	}
}

truck_bwheel2
{
	spawn
	{
		wait 100
		remove
	}
}

truck_engine
{
	spawn
	{
		wait 100
		remove
	}
}

defense
{
	spawn
	{
		wait 500
		remove
	}
}

defense_toi
{
	spawn
	{
		wait 500
		remove
	}
}

north_hacabinet_toi
{
	spawn
	{
		wait 500
		remove
	}
}

north_hacabinet_cm_marker
{
	spawn
	{
		wait 500
		remove
	}
}

north_trigger_ammo
{
	spawn
	{
		wait 400
		remove
	}
}

north_ammocabinet
{
	spawn
	{
		wait 400
		remove
	}
}


north_ammocabinet_clip
{
	spawn
	{
		wait 400
		remove
	}
}

north_trigger_heal
{
	spawn
	{
		wait 400
		remove
	}
}

north_healthcabinet
{
	spawn
	{
		wait 400
		remove
	}
}

north_healthcabinet_clip
{
	spawn
	{
		wait 400
		remove
	}
}

cabin_hacabinet_toi
{
	spawn
	{
		wait 500
		remove
	}
}

cabin_hacabinet_cm_marker
{
	spawn
	{
		wait 500
		remove
	}
}

cabin_trigger_ammo
{
	spawn
	{
		wait 400
		remove
	}
}

cabin_ammocabinet
{
	spawn
	{
		wait 400
		remove
	}
}


cabin_ammocabinet_clip
{
	spawn
	{
		wait 400
		remove
	}
}

cabin_trigger_heal
{
	spawn
	{
		wait 400
		remove
	}
}

cabin_healthcabinet
{
	spawn
	{
		wait 400
		remove
	}
}

cabin_healthcabinet_clip
{
	spawn
	{
		wait 400
		remove
	}
}

